package com.hunan.api.catv.entity.enums;

public enum ResultCode {

    ok(200, "ok"),

    failure(202, "select failure"),

    fail(500, "fail"),

    failResult(202, "fail"),

    require(400, "paras require"),

    unauthorized(401, "请登录"),

    invalid_token(403, "登录信息已过期，请重新登录");

    private final Integer code;

    private final String msg;


    ResultCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static ResultCode getResult(int code) {
        ResultCode[] rcs = ResultCode.values();
        for (ResultCode rc : rcs) {
            if (rc.getCode() == code) {
                return rc;
            }
        }
        return null;
    }
}
